UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'caU//bZR5V1rcA+T9FFLO6mdrRJLgz+nphw1pZxDrf4='
WHERE
key_id = 'f655eb21ece9c951a0617dd2a55a06ebede24bb0694e45e38625b017d9e386a4'
AND (
token = 'caU//bZR5V1rcA+T9FFLO6mdrRJLgz+nphw1pZxDrf4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)