UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7OTh1Wz5XsncKU+8xe12SVQ8pk7Ai+HKzK+qzB+acy0='
WHERE
key_id = 'f2903a240b0ea42ea29c865b8f7c09ada6eb7ed70e795e7fe5df186fcde1b51a'
AND (
token = '7OTh1Wz5XsncKU+8xe12SVQ8pk7Ai+HKzK+qzB+acy0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)