UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YxEpxzddL3zk8pH2lMiEaVtTfvX0uBGSVZBJQVtYiuk='
WHERE
key_id = 'ba3595c1970704ff1ca7e0a9da5462ae7b836dcecb43e8c50d2beb3199e1883c'
AND (
token = 'YxEpxzddL3zk8pH2lMiEaVtTfvX0uBGSVZBJQVtYiuk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)