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

Query time 0.00032