UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v5zrm49GBKD/fXfPQkeGCvnKmFEbAVWjv18mlMisSxM='
WHERE
key_id = 'c24a46df71e68606874275ba4e1d9d4afa58c5565c10d3646e71d0a35fd90ce3'
AND (
token = 'v5zrm49GBKD/fXfPQkeGCvnKmFEbAVWjv18mlMisSxM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)