UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u1KwIgxtwm8ljCXOTszQalRQgnGS5ly3OIiEMQRtMMI='
WHERE
key_id = '9a3067a67ff75ce1b5cfc701cb94c6bc5996370c55187a2895a3f9a4ff0f9c34'
AND (
token = 'u1KwIgxtwm8ljCXOTszQalRQgnGS5ly3OIiEMQRtMMI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)