UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XxbMeKyc+8+GzVIfwMkWCdDivGISUrcGFAmHF2YZWzE=' 
WHERE 
  key_id = 'cf89eefc893a00016ec7eb94e937da2025297d091091121cd39b9b4eee756b85' 
  AND (
    token = 'XxbMeKyc+8+GzVIfwMkWCdDivGISUrcGFAmHF2YZWzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023