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