UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S3eMuQzfnmz7pVhucftaDF/al3LUbnfT/aHnyOeOAGY=' 
WHERE 
  key_id = 'c87e308420204dbd3eeb09e8d1e72a1323ba062f49613046e5109890f0c8a4b6' 
  AND (
    token = 'S3eMuQzfnmz7pVhucftaDF/al3LUbnfT/aHnyOeOAGY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045