UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VsurK11icnOddvxGGVfqX4ClL0kPr6laaiSsbZRyE0g=' 
WHERE 
  key_id = 'b120d6723890918e49f4a294091f1792807af6f33f7bdec7b8154f2d53d541d8' 
  AND (
    token = 'VsurK11icnOddvxGGVfqX4ClL0kPr6laaiSsbZRyE0g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020