UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tyIAJ71iKlva9jHi6/8eqqmjz4P0LntI4oDViaIV3gc='
WHERE
key_id = '4dedacf0ea57f0462805eaf429eea0d6e45bf3cb8c0dbbfc54ac8613a7048098'
AND (
token = 'tyIAJ71iKlva9jHi6/8eqqmjz4P0LntI4oDViaIV3gc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)