UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nsbRWPnW/HTiyHtshjk36V3hmXIcRuzORNNvLlly4N8='
WHERE
key_id = 'a0cde8916b5e6ed5d233f8dbe1876d3c181b40f158f6df12daf599f41bdd892f'
AND (
token = 'nsbRWPnW/HTiyHtshjk36V3hmXIcRuzORNNvLlly4N8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)