UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Phfk7TRJ2fb/YqDieFoJnHunwyfjSP+TeJUwtAnoVWk=' 
WHERE 
  key_id = '5c8a26e329bad903f7269768193fee4273e4bcd67008c0305816f20cf1aa3719' 
  AND (
    token = 'Phfk7TRJ2fb/YqDieFoJnHunwyfjSP+TeJUwtAnoVWk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034