UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mycjYX5R9hxwq6VXvx4qM7ZVP3RaY96uk2sN/jm6vEk=' 
WHERE 
  key_id = '34a26b57d83fa5410a4a572eaeca5665fb0e8157992ea6b0cf814fd57d348663' 
  AND (
    token = 'mycjYX5R9hxwq6VXvx4qM7ZVP3RaY96uk2sN/jm6vEk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016