UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rmeZsuToMTpycc35JmqzpVRPZjeqr9MM2bqgMahjki4='
WHERE
key_id = 'f84e7657d89d769b72ea2de650a17daaab66009a7a957bf4b163c3e4224ac791'
AND (
token = 'rmeZsuToMTpycc35JmqzpVRPZjeqr9MM2bqgMahjki4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)