UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a6HR++x9rIRvhB8glqU+KvE1TtHWEeEMFrIDItk5v0A='
WHERE
key_id = '317cdd071c36a89c4b97ed2a2e000706551b89d33e0a89914b94368234c7c186'
AND (
token = 'a6HR++x9rIRvhB8glqU+KvE1TtHWEeEMFrIDItk5v0A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)