UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'udXuX4puh1/ub8/3d5SnbWqsnSrZnKvSoe71Cq1efu4=' 
WHERE 
  key_id = '793af8ee1b7c88533da2024b29f3ab8640f9731685563937196d2b5633db4775' 
  AND (
    token = 'udXuX4puh1/ub8/3d5SnbWqsnSrZnKvSoe71Cq1efu4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037