UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XWZP29KaI7dKYNCom/0bo4l5Q8dGud3T5s4Pr6c795U='
WHERE
key_id = 'b46990f8cc16999b77ab99a263a8e89a132f9ea46919083eaba1a306028734f8'
AND (
token = 'XWZP29KaI7dKYNCom/0bo4l5Q8dGud3T5s4Pr6c795U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)