UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OiaG9joXKV9l56or/vuB/lS2VetQeTDvc0MZRQRxqO4='
WHERE
key_id = 'f929dc5f130a836635abb37843aff64240e3ed7b88a8bf11504de3c1b765772e'
AND (
token = 'OiaG9joXKV9l56or/vuB/lS2VetQeTDvc0MZRQRxqO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)