UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0IiKCYGJE6KExcFN1FBAqRWDrTwEU5tE+x9cBs6pq7k='
WHERE
key_id = 'd5cfccb4673c27b971b1863e2c5ab4dcab3cdf4f66544cc093a285bb09796f9a'
AND (
token = '0IiKCYGJE6KExcFN1FBAqRWDrTwEU5tE+x9cBs6pq7k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)