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