UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k2JTwHnO3WX1cav1QjK5wF4wSAjfOBr/aKjSFgly1tU=' 
WHERE 
  key_id = '17d59e49d2854514b799f6922ae2f218481b66814121af35568e4d4247c67e70' 
  AND (
    token = 'k2JTwHnO3WX1cav1QjK5wF4wSAjfOBr/aKjSFgly1tU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021