UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ik2HncP/2xLPur0cganLDepYFpRCIQSUo7glcZ0mrcU=' 
WHERE 
  key_id = '682124b301fbd926c13e3c110fc5655d3ff6dc234e46847e8a58405b375475d3' 
  AND (
    token = 'ik2HncP/2xLPur0cganLDepYFpRCIQSUo7glcZ0mrcU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039