UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RT5jZdl7C47vW5Pt1tcveNcsHiy40By2JvfGnYq/uUo='
WHERE
key_id = 'f1d32feb50bd6926a5b15b26bead3ee407a960f53fc36775796c493ac69fc64c'
AND (
token = 'RT5jZdl7C47vW5Pt1tcveNcsHiy40By2JvfGnYq/uUo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)