UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jVV1ksjwT8tek3z5cdQwcel0Y/XNVRQCd5e2jP8EEq4='
WHERE
key_id = 'b97d10ef5dfbe398f70c37af92cecb2baefec0df4078e45a570973b27100cedc'
AND (
token = 'jVV1ksjwT8tek3z5cdQwcel0Y/XNVRQCd5e2jP8EEq4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)