UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5hlAf9Nqg/fZbmMwaxQZJyAHf7h47T+b9EEfbTcD+00='
WHERE
key_id = 'a1a45d64dadeccc1508b76ea5429858d84c1b94e6245e90d4b4368ad5ed8554c'
AND (
token = '5hlAf9Nqg/fZbmMwaxQZJyAHf7h47T+b9EEfbTcD+00='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)