UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0wLnK4i5WNxiQK2lpQCPfyj+tqAYdtNGVehRmtSq4cY=' 
WHERE 
  key_id = '8c6902887be10a2f87b7d1b9c548ec2b06bc3898c756b19aae5503b99a47332a' 
  AND (
    token = '0wLnK4i5WNxiQK2lpQCPfyj+tqAYdtNGVehRmtSq4cY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045