UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KSWY4d0eoQnsr2yalIVSpOxVO9EY0y+vnTF+8h1Prs8='
WHERE
key_id = '9d1b0bcb214aa00016638602f243aee1885cdf8502e7e20b36c7501bdc9cc74b'
AND (
token = 'KSWY4d0eoQnsr2yalIVSpOxVO9EY0y+vnTF+8h1Prs8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)