UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bh6QlMBSOWwfgIatC/2+syfiC7jADFHA3Pihsn0H3fQ='
WHERE
key_id = 'af0d742b3ea6ffcbc2a89271639b93f46affe5f288652a3a611fdc55cd92eb70'
AND (
token = 'Bh6QlMBSOWwfgIatC/2+syfiC7jADFHA3Pihsn0H3fQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)