UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j0qVxJtOLqqF57XvgSxwzgQM4bFAGd3TH1gxcy+ASD4='
WHERE
key_id = 'b1758bd915edc23667ab0a7aa4c566048c4b248dbb4f53232cfb1ecaea0c3ca4'
AND (
token = 'j0qVxJtOLqqF57XvgSxwzgQM4bFAGd3TH1gxcy+ASD4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)