UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'osmUJh0DYP+zUYiCbMz759eGkPpK4o3QI0isJT8ljU8=' 
WHERE 
  key_id = '025d709253f53af65de379fc555718352f988421966586b632725e5f3d5511bc' 
  AND (
    token = 'osmUJh0DYP+zUYiCbMz759eGkPpK4o3QI0isJT8ljU8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056