UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1YyDx6qLzWFZ1SMgwFlXGQgcY6KFJAtT5y5kfrfnLn4='
WHERE
key_id = '878faeb4cd878a641cf5578a435fc1a4b155b64a533084ecbfa221a723370d1a'
AND (
token = '1YyDx6qLzWFZ1SMgwFlXGQgcY6KFJAtT5y5kfrfnLn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)