UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pH5rQIW1+ZuwZ+DduRVgoKN5BUfT9j9F5FGKk1mvLaI='
WHERE
key_id = 'a24da6a7cf4f09f87f8cfd13079a404b571d5026bf4e62db2961f143d0e2f790'
AND (
token = 'pH5rQIW1+ZuwZ+DduRVgoKN5BUfT9j9F5FGKk1mvLaI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)