UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OurcfNEs6FbQQBrpZ6dtgJuCiBH3NvZU0txlkoeAh2M='
WHERE
key_id = 'b9fcc0050d8b9c21cf5cd01794e094440a9678b2727d052d85fab48771a52d5d'
AND (
token = 'OurcfNEs6FbQQBrpZ6dtgJuCiBH3NvZU0txlkoeAh2M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)