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